﻿using S.Authorization.Domain.Model.Authority;
using S.Authorization.Domain.SqlServer;
using S.Authorization.Infrastructure.Interface.Menu;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace S.Authorization.Infrastructure.Impl.Menu
{
    public class OperationRepository : BaseRepository<Operation>, IOperationRepository
    {
        public OperationRepository(SqlDbContext db) : base(db)
        {
        }
        /// <summary>
        /// 获取功能列表
        /// </summary>
        /// <returns></returns>
        public List<string> GetFunctionalitiesFromDatabase()
        {
            // 这里编写逻辑从数据库中获取功能列表
            // 可能涉及查询数据库、映射数据等操作

            List<string> functionalities = new List<string>();

            // 示例：从数据库表中获取功能名称列表
            var entities = db.Operation.ToList();
            functionalities = entities.Select(e => e.OperationName).ToList();

            return functionalities;
        }
    }
}
